<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div class="box">我是文字内容</div>
    <button class="btn" onclick="demo()" >点我修改文字</button>
</body>
<script>
    const box = document.querySelector(".box");
    const btn = document.querySelector(".btn");
    function demo(){
        box.innerText="我是一个盒子";    //innerText不解析标签
    }
    console.log(box.innerText)
</script>

</html>